<?php

namespace App\Http\Controllers\Mini;

use App\Http\Resources\Mini\AnnouncementResource\AnnouncementClassCollection;
use App\Models\Announcement;
use App\Models\Notice;
use Illuminate\Http\Request;

class AnnouncementController extends BaseController
{
    public function index(Request $request, Announcement $announcement_model)
    {
        $announcement_model->where(['is_delete' => 1]);
        if ($request->has("community_id")) {
            $announcement_model->whereFindRaw("community_id",$request->get("community_id"));
        }
        $list = $announcement_model->orderByDesc('id')->get();
        return $this->success(new AnnouncementClassCollection($list));
    }
}
